<template>
  <div class="container">
    <div class="app-container">
      <el-form label-width="120px">
        <el-form-item label="温度:">
          <span>{{ temperature }}°</span>
        </el-form-item>
        <el-form-item label="设备状态:">
          <span
            v-if="temperature > 35"
            style="color:red"
          >警告:温度超过35°，设备发电量和使用寿命将降低，请安装散热器</span>
          <span v-else>设备运行正常</span>
        </el-form-item>
      </el-form>

      <el-table :data="list" style="width: 100%">
        <el-table-column type="index" label="序号" />
        <el-table-column prop="name" label="设备型号" />
        <el-table-column label="峰值功率(w)">
          <template v-slot="{ row }">
            <span :key="row.zip">{{ (Math.random() * 400 + 2).toFixed(1) + 'w' }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="workNumber" label="开路电压">
          <template v-slot="{ row }">
            <span :key="row.zip">{{ (Math.random() * 26 + 18 ).toFixed(1)+ 'w' }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="workNumber" label="最大功率点电压">
          <template v-slot="{ row }">
            <span :key="row.zip">{{ (Math.random() * 21 + 16 ).toFixed(1)+ 'w' }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="address" label="设备位置" />
        <el-table-column prop="date" width="130" label="设备投入时间">
          <span>{{ new Date("2021-10-22").toLocaleDateString() }}</span>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>
<script>
export default {
  name: 'Device',
  data() {
    return {
      // 温度
      temperature: (Math.random() * 50).toFixed(1),

      list: [{
        date: '2023-04-03',
        name: 'LX-1243-Y',
        life: '可研阶段',
        address: '湖南省长沙市岳麓区枫林三路99号',
        zip: 1,
        peakPower: (Math.random() * 400).toFixed(1) + 'w'
      }, {
        date: '2023-03-26',
        name: 'LX-1343-Y',
        life: '可研阶段',
        address: '湖南省长沙市岳麓区枫林三路99号',
        zip: 2
      }, {
        date: '2023-01-22',
        name: 'LX-1543-Y',
        life: '建设阶段',
        address: '湖南省长沙市岳麓区枫林三路99号',
        zip: 3
      }, {
        date: '2023-01-01',
        name: 'LX-1843-Y',
        life: '建设阶段',
        address: '湖南省长沙市岳麓区枫林三路99号',
        zip: 4
      }, {
        date: '2022-05-08',
        name: 'LX-1943-Y',
        life: '生产运行阶段',
        address: '湖南省长沙市岳麓区枫林三路99号',
        zip: 5
      }, {
        date: '2022-10-06',
        name: 'LX-1143-Y',
        life: '设计阶段',
        address: '湖南省长沙市岳麓区枫林三路99号',
        zip: 6
      }, {
        date: '2022-08-17',
        name: 'LX-1243-Y',
        life: '设计阶段',
        address: '湖南省长沙市岳麓区枫林三路99号',
        zip: 7
      }]
    }
  }
}
</script>

